﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using TTGame;
using System;

/*
 * OptionID
 *
 *
 *
 * 依赖：
 *
 * ！不写重复代码！
 * @author TTun
 * @date 7/28/2017 9:09:01 AM
 */
namespace TTGameEngine {

[System.Serializable]
public class IOptionID {

    //-1的话是Everything。即LayerMask，现在Prefab都已经使用了，不好改变量名。
    [SerializeField]
    private int m_LayerIndex = 0;

    public int LayerIndex {
        get { return m_LayerIndex; }
    }

    public void Set(int _layerIndex) {
        m_LayerIndex = _layerIndex;
    }

    public virtual string[] Names {
        get {return null;}
    }

    public bool IsNothing() {
        return m_LayerIndex == 0;
    }

    public bool IsID(int idx) {
        return m_LayerIndex == (1 << idx);
    }

    public bool CheckMaskWithID(int idx) {

        return (m_LayerIndex & 1 << idx) >= 1;
    }
}

/// <summary>
/// TargetTypeID
///
/// 是TargetSelectType的Mask形式。
/// 为了使枚举TargetSelectType拥有Mask控件表现。
///
///
///
/// </summary>
[System.Serializable]
public class TargetTypeID : IOptionID {
    public override string[] Names {
        get {
            return Enum.GetNames(typeof(TargetSelectType));
        }
    }
}

}
